<template>
  <div class="app-container">
    <div class="top-box">
      <div class="top-min-box">
        采购订单 拉取时间2024-11-25 16：00
      </div>
      <el-form :model="queryParams" ref="queryForm" size="small" :inline="true"  label-width="88px">
            <el-form-item label="" prop="no" style="width: 400px;">
              <el-input v-model="queryParams.no" style="width: 400px;" placeholder="请输入工华编号/生产订单号/销售订单行项目"clearable />
            </el-form-item>
            <el-form-item>
              <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
              <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
            </el-form-item>
            <el-form-item>
              <el-button icon="el-icon-plus" size="mini" @click="handleAdd">新增销售订单</el-button>
            </el-form-item>
        </el-form>
    </div>
    <div class="content-box">
      <el-card class="box-card" >
        <el-form :model="queryParams1" ref="queryForm" size="small"  label-width="88px">
            <el-form-item label="订单总条数" >
                <el-radio-group v-model="queryParams1.type" @change="choose0Status(queryParams1.type)">
                  <el-radio v-for="(item, index) in radioList" :key="index" :label="item.id" >{{item.name + ' '+ item.num}}</el-radio>
                </el-radio-group>
              </el-form-item>
            <el-form-item  label="订单分类">
                <el-radio-group v-model="queryParams1.radio1" @change="chooseStatus(queryParams1.radio1)">
                  <el-radio-button v-for="(item, index) in radio1List" :key="index" :label="item.name">{{item.name + ' '+ item.num}}</el-radio-button>
                </el-radio-group>
              </el-form-item>
        </el-form>
        <el-table border v-loading="loading" :data="dataList" style="width: 100%"
            :max-height="tableMaxHeight">
            <el-table-column label="关注" align="center" prop="purchaserlaCode">
              <template slot-scope="scope">
                <el-button size="mini" type="warning"   @click="handleUpdate(scope.row)"  v-if="scope.row.type == '1'">已关注</el-button>
                <el-button size="mini"  @click="handleUpdate(scope.row)" v-else>关注</el-button>
              </template>
            </el-table-column>
            <el-table-column label="销售订单号" align="center" prop="supplierCode"> 
              <template slot-scope="scope">
              <router-link :to="'/factory/orderCenter/saleOrder/saleOrderDetail/' + scope.row.supplierCode" class="link-type">
                <span>{{ scope.row.supplierCode }}</span>
              </router-link>
            </template>
            </el-table-column>
            <el-table-column label="采购订单号" align="center" prop="supplierCode"> 
              <template slot-scope="scope">
              <router-link :to="'/factory/orderCenter/buyOrder/buyOrderDetail/' + scope.row.supplierCode" class="link-type">
                <span>{{ scope.row.supplierCode }}</span>
              </router-link>
            </template>
            </el-table-column>
            <el-table-column label="合同名称" align="center" prop="supplierName"/>
            <el-table-column label="合同编号" align="center" prop="purchaserlaCode"/>
            <el-table-column label="物资品类" align="center" prop="modifyStartTime"/>
            <el-table-column label="当前填报环节" align="center" prop="modifyStartTime"/>
            <el-table-column label="操作" align="center" fixed="right"  width="120" class-name="small-padding fixed-width">
              <template slot-scope="scope">
                <!-- <el-button size="mini" type="text" icon="el-icon-view" @click="handlesUpdate(scope.row)" >详情</el-button> -->
                <router-link :to="'/factory/orderCenter/saleOrder/saleOrderDetail/' + scope.row.supplierCode" class="link-type">
                <span>详情</span>
              </router-link>
                <el-button size="mini" type="text" icon="el-icon-edit" @click="handlesUpdate(scope.row)" >编辑</el-button>
                <el-button slot="reference" size="mini" type="text" icon="el-icon-delete">删除
                </el-button>
                <el-popconfirm :title="`确认删除当前数据项？`" @confirm="handleDelete(scope.row)"v-if="scope.row.status == 'wkp' && scope.row.amountReal == 0"style="margin-left: 10px;">
                  <el-button slot="reference" size="mini" type="text" icon="el-icon-delete">删除
                  </el-button>
                </el-popconfirm>
              </template>
            </el-table-column>
          </el-table>
  <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum"
              :limit.sync="queryParams.pageSize" @pagination="getList"/>
      </el-card>
    </div>
    <addSaleOrder-form ref="form" @ok="getList"></addSaleOrder-form>
  </div>
  
</template>

<script>
import {deleteAction, getAction, updateAction, getById} from '@/api/manage'
import AddSaleOrderForm from '@/views/develop/factory/module/AddSaleOrderForm'
export default {
  components: {
    AddSaleOrderForm
  },
  data() {
    return {
      baseUrl: process.env.VUE_APP_BASE_API,
      queryParams:{
        
        pageNum: 1,
        pageSize: 20,
      },
      queryParams1: {
        type:'',
        type2:'',
        radio1: '全部',
      },
      radioList: [
          {
            name:'无采购订单号',
            num:'9',
            id:'1',
          },{
            name:'已关注',
            num:'6',
            id:'2',
          },{
            name:'已归档',
            num:'5',
            id:'3',
          }
        ],
        radio1List: [
          {
            name:'全部',
            num:'',
            id:'1',
          },{
            name: '维护的售订单行',
            num:'9',
            id:'2',
          },{
            name: '制定排产计划',
            num:'6',
            id:'3',
          },{
            name: '填报生产订单',
            num:'14',
            id:'4',
          },{
            name: '填报生产数据',
            num:'35',
            id:'5',
          },{
            name: '同步订单数据',
            num:'17',
            id:'6',
          },{
            name: '触发质量评分',
            num:'0',
            id:'7',
          }
        ],
      // 遮罩层
      loading: true,
      // 总条数
      total: 9,
      dataList:[{
        type:1,
        purchaserlaCode: 'HE20230005299',
        supplierCode: '4650011735',
        supplierName: '国网河北省电力有限公司',
        sellerSignStartTime: '2024-10-11',
        sellerSignEndTime: '2024-10-13',
        modifyStartTime: '待补全',
        conValidStartTime: '待补全',
        conValidSEndTime: '待补全',
        sellerConCode: '待补全',
        conCode: '待补全',
        poNo: '4100373079',
      },
      {
        purchaserlaCode: 'HE20230005299',
        supplierCode: '4650011735',
        supplierName: '国网河北省电力有限公司',
        sellerSignStartTime: '2024-10-11',
        sellerSignEndTime: '2024-10-13',
        modifyStartTime: '待补全',
        conValidStartTime: '待补全',
        conValidSEndTime: '待补全',
        sellerConCode: '待补全',
        conCode: '待补全',
        poNo: '4100373079',
      },
      {
        purchaserlaCode: 'HE20230005299',
        supplierCode: '4650011735',
        supplierName: '国网河北省电力有限公司',
        sellerSignStartTime: '2024-10-11',
        sellerSignEndTime: '2024-10-13',
        modifyStartTime: '待补全',
        conValidStartTime: '待补全',
        conValidSEndTime: '待补全',
        sellerConCode: '待补全',
        conCode: '待补全',
        poNo: '4100373079',
      },
      {
        purchaserlaCode: 'HE20230005299',
        supplierCode: '4650011735',
        supplierName: '国网河北省电力有限公司',
        sellerSignStartTime: '2024-10-11',
        sellerSignEndTime: '2024-10-13',
        modifyStartTime: '待补全',
        conValidStartTime: '待补全',
        conValidSEndTime: '待补全',
        sellerConCode: '待补全',
        conCode: '待补全',
        poNo: '4100373079',
      },
      {
        purchaserlaCode: 'HE20230005299',
        supplierCode: '4650011735',
        supplierName: '国网河北省电力有限公司',
        sellerSignStartTime: '2024-10-11',
        sellerSignEndTime: '2024-10-13',
        modifyStartTime: '待补全',
        conValidStartTime: '待补全',
        conValidSEndTime: '待补全',
        sellerConCode: '待补全',
        conCode: '待补全',
        poNo: '4100373079',
      },
      {
        purchaserlaCode: 'HE20230005299',
        supplierCode: '4650011735',
        supplierName: '国网河北省电力有限公司',
        sellerSignStartTime: '2024-10-11',
        sellerSignEndTime: '2024-10-13',
        modifyStartTime: '待补全',
        conValidStartTime: '待补全',
        conValidSEndTime: '待补全',
        sellerConCode: '待补全',
        conCode: '待补全',
        poNo: '4100373079',
      },
      {
        purchaserlaCode: 'HE20230005299',
        supplierCode: '4650011735',
        supplierName: '国网河北省电力有限公司',
        sellerSignStartTime: '2024-10-11',
        sellerSignEndTime: '2024-10-13',
        modifyStartTime: '待补全',
        conValidStartTime: '待补全',
        conValidSEndTime: '待补全',
        sellerConCode: '待补全',
        conCode: '待补全',
        poNo: '4100373079',
      },
      {
        purchaserlaCode: 'HE20230005299',
        supplierCode: '4650011735',
        supplierName: '国网河北省电力有限公司',
        sellerSignStartTime: '2024-10-11',
        sellerSignEndTime: '2024-10-13',
        modifyStartTime: '待补全',
        conValidStartTime: '待补全',
        conValidSEndTime: '待补全',
        sellerConCode: '待补全',
        conCode: '待补全',
        poNo: '4100373079',
      },
      {
        purchaserlaCode: 'HE20230005299',
        supplierCode: '4650011735',
        supplierName: '国网河北省电力有限公司',
        sellerSignStartTime: '2024-10-11',
        sellerSignEndTime: '2024-10-13',
        modifyStartTime: '待补全',
        conValidStartTime: '待补全',
        conValidSEndTime: '待补全',
        sellerConCode: '待补全',
        conCode: '待补全',
        poNo: '4100373079',
      },
      {
        purchaserlaCode: 'HE20230005299',
        supplierCode: '4650011735',
        supplierName: '国网河北省电力有限公司',
        sellerSignStartTime: '2024-10-11',
        sellerSignEndTime: '2024-10-13',
        modifyStartTime: '待补全',
        conValidStartTime: '待补全',
        conValidSEndTime: '待补全',
        sellerConCode: '待补全',
        conCode: '待补全',
        poNo: '4100373079',
      }],
      tableMaxHeight: window.innerHeight - 320,
      url: {
          list: '/goodsInvoice/goodsInvoice/list',
          remove: '/goodsInvoice/goodsInvoice/',
          export: '/goodsInvoice/goodsInvoice/export',
      },
      redirect: undefined
    };
  },
  watch: {
          $route: {
              handler: function (route) {
                  this.redirect = route.query && route.query.redirect
              },
              immediate: true
          }
      },
  created() {
    this.getList();
  },
  destroyed() {
    
  },
  methods: {
    chooseStatus(e) {
        this.loading = true
        if (e == '全部') {
          this.dataList = [{
          type:1,
          purchaserlaCode: 'HE20230005299',
          supplierCode: '4650011735',
          supplierName: '国网河北省电力有限公司',
          sellerSignStartTime: '2024-10-11',
          sellerSignEndTime: '2024-10-13',
          modifyStartTime: '待补全',
          conValidStartTime: '待补全',
          conValidSEndTime: '待补全',
          sellerConCode: '待补全',
          conCode: '待补全',
          poNo: '4100373079',
        },
        {
          purchaserlaCode: 'HE20230005300',
          supplierCode: '4650011736',
          supplierName: '国网河北省电力有限公司沧州供电分公司',
          sellerSignStartTime: '2024-10-11',
          sellerSignEndTime: '2024-10-13',
          modifyStartTime: '待补全',
          conValidStartTime: '待补全',
          conValidSEndTime: '待补全',
          sellerConCode: '待补全',
          conCode: '待补全',
          poNo: '4100373080',
        },
        {
          purchaserlaCode: 'HE20230005301',
          supplierCode: '4650011737',
          supplierName: '国网宁夏电力有限公司石嘴山供电公司',
          sellerSignStartTime: '2024-10-11',
          sellerSignEndTime: '2024-10-13',
          modifyStartTime: '待补全',
          conValidStartTime: '待补全',
          conValidSEndTime: '待补全',
          sellerConCode: '待补全',
          conCode: '待补全',
          poNo: '4100373081',
        },
        {
          purchaserlaCode: 'HE20230005302',
          supplierCode: '4650011738',
          supplierName: '国网宁夏电力有限公司石嘴山供电公司',
          sellerSignStartTime: '2024-10-11',
          sellerSignEndTime: '2024-10-13',
          modifyStartTime: '待补全',
          conValidStartTime: '待补全',
          conValidSEndTime: '待补全',
          sellerConCode: '待补全',
          conCode: '待补全',
          poNo: '4100373082',
        },
        {
          purchaserlaCode: 'HE20230005303',
          supplierCode: '4650011739',
          supplierName: '国网陕西省电力公司商洛供电公司',
          sellerSignStartTime: '2024-10-11',
          sellerSignEndTime: '2024-10-13',
          modifyStartTime: '待补全',
          conValidStartTime: '待补全',
          conValidSEndTime: '待补全',
          sellerConCode: '待补全',
          conCode: '待补全',
          poNo: '4100373083',
        },
        {
          purchaserlaCode: 'HE20230005304',
          supplierCode: '4650011740',
          supplierName: '国网河北省电力有限公司临城县供电分公司',
          sellerSignStartTime: '2024-10-11',
          sellerSignEndTime: '2024-10-13',
          modifyStartTime: '待补全',
          conValidStartTime: '待补全',
          conValidSEndTime: '待补全',
          sellerConCode: '待补全',
          conCode: '待补全',
          poNo: '4100373084',
        },
        {
          purchaserlaCode: 'HE20230005305',
          supplierCode: '4650011741',
          supplierName: '国网河北省电力有限公司沧州供电分公司',
          sellerSignStartTime: '2024-10-11',
          sellerSignEndTime: '2024-10-13',
          modifyStartTime: '待补全',
          conValidStartTime: '待补全',
          conValidSEndTime: '待补全',
          sellerConCode: '待补全',
          conCode: '待补全',
          poNo: '4100373085',
        },
        {
          purchaserlaCode: 'HE20230005306',
          supplierCode: '4650011742',
          supplierName: '国网河北省电力有限公司邢台供电分公司',
          sellerSignStartTime: '2024-10-11',
          sellerSignEndTime: '2024-10-13',
          modifyStartTime: '待补全',
          conValidStartTime: '待补全',
          conValidSEndTime: '待补全',
          sellerConCode: '待补全',
          conCode: '待补全',
          poNo: '4100373086',
        },
        {
          purchaserlaCode: 'HE20230005307',
          supplierCode: '4650011743',
          supplierName: '国网陕西省电力公司渭南供电公司',
          sellerSignStartTime: '2024-10-11',
          sellerSignEndTime: '2024-10-13',
          modifyStartTime: '待补全',
          conValidStartTime: '待补全',
          conValidSEndTime: '待补全',
          sellerConCode: '待补全',
          conCode: '待补全',
          poNo: '4100373087',
        },
        {
          purchaserlaCode: 'HE20230005308',
          supplierCode: '4650011744',
          supplierName: '国网河北省电力有限公司沧州供电分公司',
          sellerSignStartTime: '2024-10-11',
          sellerSignEndTime: '2024-10-13',
          modifyStartTime: '待补全',
          conValidStartTime: '待补全',
          conValidSEndTime: '待补全',
          sellerConCode: '待补全',
          conCode: '待补全',
          poNo: '4100373088',
        }]
        }
        setTimeout(res=>{
          this.loading = false
        },500)
        console.log(e,'这里是什么啊')
      },
    choose0Status(e) {
        this.loading = true
        setTimeout(res=>{
          this.loading = false
        },500)
        console.log(e,'这里是什么啊')
      },
    /** 新增按钮操作 */
    handleAdd() {
        this.$refs.form.handleAdd();
    },
    /** 修改按钮操作 */
    handlesUpdate(row) {
      this.$refs.form.handleUpdate({id:'2158c24d77034a25a62286eb570a6911'});
        // this.$refs.form.handleUpdate(row);
    },
    // 跳转到详情页面
    gotoDetail(e) {
        // console.log(this.$router,'这是详情啊')
        this.$router.push("/develop/factory/BuyOrderDetail");
        // this.$router.push({ path: "/develop/factory/BuyOrderDetail" }).catch(()=>{});
    },
    /** 查询发票管理列表 */
    getList() {
        this.loading = true;
        // getAction(this.url.list, this.queryParams).then(response => {
        //     this.dataList = response.rows;
        //     this.total = response.total;
        //     this.loading = false;
        // });
        this.loading = false;
    },
    /** 搜索按钮操作 */
    handleQuery() {
        this.queryParams.pageNum = 1;
        this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
        this.resetForm("queryForm");
        this.handleQuery();
    },
  }
};
</script>
<style lang="scss" scoped>
.app-container {
  width: 100%;

  .top-box {
    .top-min-box {
      font-weight: bold;
      margin-top: 15px;
      margin-bottom: 15px;
    }
    .top-cent-box {
      display: flex;
      align-items: center;
      .top-cent-item {
        padding-left: 10px;
        padding-right: 10px;
        border-right: 1px solid #626262;
        .title {
          color: #B6B5B7;
        }
        .text {
          margin-top: 10px;
        }
      }
      .bnt-box {
        margin-left: auto;
      }
    }
  }
  .content-box {
  // background: #F8F8F8;
    margin-top: 20px;
    display: flex;
    width: 100%;
      .box-card {
        width: 100%;
        .bgtitle {
          margin-bottom: 20px;
        }
      }
  }
}
</style>

